import 'package:flutter/material.dart';

class ClassType extends StatefulWidget {
  const ClassType({Key? key}) : super(key: key);

  @override
  State<ClassType> createState() => _ClassTypeState();
}

class _ClassTypeState extends State<ClassType> {
  int count = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_outlined, color: Colors.white),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        title: Text("分类", style: TextStyle(color: Colors.white)),
        backgroundColor: Colors.blue,
        centerTitle: true,
      ),
      body: Center(
        child: GestureDetector(
          onTap: () {
            setState(() {
              count++;
            });
            Navigator.pushNamed(context, "/search",arguments: {
              "title":"我是参数",
              "goodsId":20
            });
          },
          child: Container(
            width: 300,
            height: 300,
            color: Colors.red,
            alignment: Alignment.center,
            child: Text("跳转到搜索 $count", style: const TextStyle(color: Colors.white)),
          ),
        ),
      )
    );
  }
}
